/*
 * Copyright 2010 Michael Nitsche
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package de.mnit.basis.fehler;

import de.mnit.basis.daten.struktur.liste.Liste;
import de.mnit.basis.daten.struktur.liste.S_Liste;


/**
 * @author Michael Nitsche
 * 21.05.2007	Erstellt
 */
public class FehlerHilfe {

//	Nicht verwendet!
//	public static Gruppe3<String,Throwable,S_Liste<Object>> parameter(String text, Object... o) {
//		Throwable grund=null;
//		S_Liste<Object> anhang=Liste.neu();
//		for(Object objekt : o)
//			if(objekt instanceof Throwable && grund==null) grund=(Throwable)objekt;
//			else anhang.plus(objekt);
//		return Gruppe3.neu(text,grund,anhang);
//	}

	public static Throwable grund(Object... oa) {
		for(Object o : oa)
			if(o instanceof Throwable)
				return (Throwable)o;
		return null;
	}

	public static S_Liste<Object> anhang(Object... oa) {
		Throwable grund=null;
		S_Liste<Object> anhang=Liste.neu();
		for(Object o : oa)
			if(o instanceof Throwable && grund==null)
				grund=(Throwable)o;
			else
				anhang.plus(o);
		return anhang;
	}

}
